<?php
namespace app\common\validate;

use think\Validate;

class MemberLevel extends Validate
{
    protected $rule = [
        'level_name' => 'require|unique:agent_level',
        'min_grade'  => 'require|number',
        'max_grade'  => 'require|number',
        'discount'   => 'require|number',
        'sorts'      => 'require',
    ];

    protected $message = [
        'level_name.require' => '{%level_name_require}',
        'level_name.unique'  => '{%level_name_unique}',
        'min_grade.require'  => '{%min_grade_require}',
        'min_grade.number'   => '{%grade_number}',
        'max_grade.require'  => '{%max_grade_require}',
        'max_grade.number'   => '{%grade_number}',
        'discount.require'   => '{%discount_require}',
        'discount.number'    => '{%discount_number}',
        'sorts' => '{%sorts_val}',
    ];

    protected $scene = [
        'add'   => ['level_name','min_grade','discount'],
        'edit'  => ['level_name','min_grade','discount'],
        'sorts' => ['sorts'],
    ];
}